﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/**
 * The following example is fine.
 * A more straightforward example is provided by wikipedia:
 * http://en.wikipedia.org/wiki/Facade_pattern
 */

namespace DesignPatternsDemo.Facade
{
    public class OrderFacade : ICustomerDetail, IProductDetail 
    {
        private Customer _customer;
        private Product _product;

        public OrderFacade(Customer customer, Product product)
        {
            _customer = customer;
            _product = product;
        }

        public string GetCustomerName()
        {
            return _customer.GetCustomerName();
        }

        public string GetAddress()
        {
            return _customer.GetAddress();
        }

        public string GetProductName()
        {
            return _product.GetProductName();
        }

        public string GetDescription()
        {
            return _product.GetDescription();
        }
    }

    public interface ICustomerDetail
    {
        string GetCustomerName();
        string GetAddress();
    }

    public interface IProductDetail
    {
        string GetProductName();
        string GetDescription();
    }

    public class Customer : ICustomerDetail
    {
        private string _name;
        private string _address;

        public Customer(string name, string address)
        {
            _name = name;
            _address = address;
        }

        public string GetCustomerName()
        {
            return _name;
        }

        public string GetAddress()
        {
            return _address;
        }
    }

    public class Product : IProductDetail
    {
        private string _name;
        private string _description;

        public Product(string name, string descripion)
        {
            _name = name;
            _description = descripion;
        }

        public string GetProductName()
        {
            return _name;
        }

        public string GetDescription()
        {
            return _description;
        }
    }
}
